//
//  SIngleLabelCell.m
//  QuXiang
//
//  Created by Duncan on 2020/6/22.
//  Copyright © 2020 NanHuaiZi. All rights reserved.
//

#import "SIngleLabelCell.h"

@implementation SIngleLabelCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.clipsToBounds = YES;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self masonryLayout];
    }
    return self;
}

#pragma mark ------- Public Methods -------

- (void)centerLabelMasLayout {
    [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
    }];
}



#pragma mark ------- Lazy Methods -------

- (void)masonryLayout {
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(kFragmemtFloat(15));
        make.right.equalTo(self.contentView.mas_right).offset(-kFragmemtFloat(15));
        make.centerY.equalTo(self.contentView);
    }];
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor blackColor];
        [_titleLabel setFont:kAdaptedFontSize(15)];
    }
    return _titleLabel;
}

@end
